<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="jsp_header.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="/resources/js/jquery-2.1.1.min.js"></script>
<script src="/resources/js/jquery.form.js"></script>
<script src="/resources/js/jquery.cookie.js"></script>
<title>Insert title here</title>
<link type="text/css" rel="stylesheet" href="/resources/common/common.css">
<script>
	function check_form2(str) {
		if (!form2.opts1.value) {
			alert("옵션1을 선택하십시요.");
			form2.opts1.focus();
			return;
		}
		if (!form2.opts2.value) {
			alert("옵션2를 선택하십시요.");
			form2.opts2.focus();
			return;
		}
		if (!form2.quantity.value) {
			alert("수량을 입력하십시요.");
			form2.num.focus();
			return;
		}
		if (str == "D") {
			form2.action = "/order/orderDirect";
			form2.submit();
		} else if(str == "C"){
			form2.action = "/cart/cartAdd";
			form2.submit();
		} else if(str == "B"){
			form2.action = "/basket/basketAdd";
			form2.submit();
		}
	}
	
/* 		function JoinCheck() {
			var product_no = $('#product_no').val();
			var user_no = $('#user_no').val();
			var opts1 = $('#opts1').val();
			var opts2 = $('#opts2').val();
			$.ajax({
				type : "POST",
				url : "/basket/basketAdd",
				data : {
					product_no : product_no,
					user_no : user_no,
					opts1 : opts1,
					opts2 : opts2
				},
				dataType : "json"
			//contentType: "application/json; charset=utf-8"
			}).done(function(msg) {
				//alert(msg.message);
				//var html = '<div>'+msg.message+'</div>';
				alert('상품이 등록되었습니다.');
			});
		} */
</script>
</head>
<body>
	<jsp:include page="main_header.jsp"></jsp:include><br>
	<div id=container>

		<table border="0" cellpadding="0" cellspacing="0" width="747">
			<tr>
				<td height="13"></td>
			</tr>
			<tr>
				<td height="30"><img src="/resources/image/product_title3.gif"
					width="746" height="30" border="0"></td>
			</tr>
			<tr>
				<td height="10"></td>
			</tr>
		</table>

		<form name="form2" method="post" action="">
			<input type="hidden" name="no" id="product_no" value="${product.NO}">
			<input type="hidden" name="no" id="user_no" value="${sessionScope.loginUser.no}">
		 	<input type="hidden" name="name" value="${product.NAME}"> 
		 	<input type="hidden" name="price" value="${product.PRICE}"> 
		 	<input type="hidden" name="content" value="${product.description}">
			<%-- <input type="hidden" name="status" value="${product.STATUS}"> --%>
			<input type="hidden" name="icon_new" value="${product.ICON_NEW}">
			<input type="hidden" name="icon_hit" value="${product.ICON_HIT}">
			<input type="hidden" name="icon_sale" value="${product.ICON_SALE}">
			<input type="hidden" name="discount" value="${product.DISCOUNT}">
			<input type="hidden" name="image" value="${image[0]}">



			<table border="0" cellpadding="0" cellspacing="0" width="745">
				<tr>
					<td width="335" align="center" valign="top">
						<!-- 상품이미지 -->
						<table border="0" cellpadding="0" cellspacing="1" width="315"
							height="315" bgcolor="D4D0C8">
							<tr>
								<td bgcolor="white" align="center"><img
									src="/resources/image/${image[0]}" height="315" border="0"
									align="absmiddle" ONCLICK="Zoomimage('0000')"
									STYLE="cursor: hand"></td>
							</tr>
						</table>
					</td>
					<td width="410 " align="center" valign="top">
						<!-- 상품명 -->
						<table border="0" cellpadding="0" cellspacing="0" width="370"
							class="cmfont">
							<tr>
								<td colspan="3" bgcolor="E8E7EA"></td>
							</tr>
							<tr>
								<td width="80" height="45" style="padding-left: 10px"><img
									src="images/i_dot1.gif" width="3" height="3" border="0"
									align="absmiddle"> <font color="666666"><b>제품명</b></font>

								</td>
								<td width="1" bgcolor="E8E7EA"></td>
								<td style="padding-left: 10px"><font color="282828">${product.NAME}</font><br>
									<c:if test="${product.ICON_NEW!=null}">
										<img src="/resources/image/i_new.gif" align="absmiddle"
											vspace="1">
									</c:if> <c:if test="${product.ICON_HIT!=null}">
										<img src="/resources/image/i_hit.gif" align="absmiddle"
											vspace="1">
									</c:if> <c:if test="${product.ICON_SALE!=null}">
										<img src="/resources/image/i_sale.gif" align="absmiddle"
											vspace="1">
									</c:if></td>
							</tr>
							<tr>
								<td colspan="3" bgcolor="E8E7EA"></td>
							</tr>
							<!-- 시중가 -->
							<tr>
								<td width="80" height="35" style="padding-left: 10px"><img
									src="/resources/image/i_dot1.gif" width="3" height="3"
									border="0" align="absmiddle"> <font color="666666"><b>소비자가</b></font>
								</td>
								<td width="1" bgcolor="E8E7EA"></td>
								<td width="289" style="padding-left: 10px"><font
									color="666666"><fmt:formatNumber
											value="${product.PRICE}" type="currency" /></font></td>
							</tr>
							<tr>
								<td colspan="3" bgcolor="E8E7EA"></td>
							</tr>
							<!-- 판매가 -->
							<tr>
								<td width="80" height="35" style="padding-left: 10px"><img
									src="/resources/image/i_dot1.gif" width="3" height="3"
									border="0" align="absmiddle"> <font color="666666"><b>판매가</b></font>
								</td>
								<td width="1" bgcolor="E8E7EA"></td>
								<td width="289" style="padding-left: 10px"><font
									color="0288DD"> <b> <c:if
												test="${product.ICON_SALE!=null}">
												<fmt:formatNumber
													value="${product.PRICE-(product.PRICE*(product.DISCOUNT/100))}"
													type="currency" />
											</c:if> <c:if test="${product.ICON_SALE==null}">
												<fmt:formatNumber value="${product.PRICE}" type="currency" />
											</c:if>
									</b>
								</font></td>
							</tr>
							<tr>
								<td colspan="3" bgcolor="E8E7EA"></td>
							</tr>
							<!-- 옵션 -->
							<tr>
								<td width="80" height="35" style="padding-left: 10px"><img
									src="/resources/image/i_dot1.gif" width="3" height="3"
									border="0" align="absmiddle"> <font color="666666"><b>옵션선택</b></font>
								</td>
								<td width="1" bgcolor="E8E7EA"></td>
								<td style="padding-left: 10px"><select name="opts1" id="opts1" class="cmfont1">
										<option value="">선택하세요</option>
										<c:forEach items="${detailList1}" var="item">
											<option value="${item.name}">${item.name}</option>
										</c:forEach>
								</select> &nbsp; <select name="opts2" id="opts2"  class="cmfont1">
										<option value="">선택하세요</option>
										<c:forEach items="${detailList2}" var="item">
											<option value="${item.name}">${item.name}</option>
										</c:forEach>
								</select></td>
							</tr>
							<tr>
								<td colspan="3" bgcolor="E8E7EA"></td>
							</tr>
							<!-- 수량 -->
							<tr>
								<td width="80" height="35" style="padding-left: 10px"><img
									src="/resources/image/i_dot1.gif" width="3" height="3"
									border="0" align="absmiddle"> <font color="666666"><b>수량</b></font>
								</td>
								<td width="1" bgcolor="E8E7EA"></td>
								<td style="padding-left: 10px"><input type="text"
									name="quantity" size="3" style="padding: 0px;" maxlength="5"
									class="cmfont1"> <font color="666666">개</font></td>
							</tr>
							<tr>
								<td colspan="3" bgcolor="E8E7EA"></td>
							</tr>
						</table>
						<table border="0" cellpadding="0" cellspacing="0" width="370"
							class="cmfont">
							<tr>
								<td height="70" align="center">
									<a href="javascript:check_form2('B')">
											<img src="/resources/image/cash1.jpg" border="0" align="absmiddle">
									</a>&nbsp;
									<a href="javascript:check_form2('D')">
											<img src="/resources/image/b_order.gif" border="0" align="absmiddle">
									</a>&nbsp;
									<a href="javascript:check_form2('C')">
										<img src="/resources/image/b_cart.gif" border="0" align="absmiddle">
									</a>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>

		<!-- 상세설명 -->
		<table border="0" cellpadding="0" cellspacing="0" width="747">
			<tr>
				<td height="13"></td>
			</tr>
		</table>
		<table border="0" cellpadding="0" cellspacing="0" width="746">
			<tr>
				<td height="30" align="center"><img
					src="/resources/image/product_title.gif" width="746" height="30"
					border="0"></td>
			</tr>
		</table>
		<table border="0" cellpadding="0" cellspacing="0" width="746"
			style="font-size: 9pt">
			<tr>
				<td height="13"></td>
			</tr>
			<tr>
				<td height="200" valign=top style="line-height: 14pt">본제품의
					상세설명은 다음과 같습니다. <br> <br>
					<center>
						<c:forEach items="${image}" var="image">
							<img src="/resources/image/${image}" align="absmiddle" vspace="1">
							<br>
							<br>
							<br>
						</c:forEach>
						<%-- 		<c:if test="${product.image4!=null}"><img src="./resources/image/${product.image4}" align="absmiddle" vspace="1"></c:if>&nbsp
						<c:if test="${product.image5!=null}"><img src="./resources/image/${product.image5}" align="absmiddle" vspace="1"></c:if> --%>
						<br> <br>
					</center>
				</td>
			</tr>
		</table>

		<!-- 교환배송정보 -->
		<table border="0" cellpadding="0" cellspacing="0" width="746"
			class="cmfont">
			<tr>
				<td height="10"></td>
			</tr>
		</table>
		<table border="0" cellpadding="0" cellspacing="0" width="746">
			<tr>
				<td align="center" class="cmfont">배송정보 어쩌고저쩌고........</td>
			</tr>
		</table>
		<table border="0" cellpadding="0" cellspacing="0" width="746"
			class="cmfont">
			<tr>
				<td height="10"></td>
			</tr>
		</table>
		</div>
		
		<jsp:include page="main_bottom.jsp"></jsp:include>



</body>


</html>
